package com.xuecheng.framework.web;


import com.xuecheng.framework.utils.XcOauth2Util;
import org.springframework.web.bind.annotation.ModelAttribute;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * Created by mrt on 2018/5/22.
 */
public class BaseController {
    protected HttpServletRequest request;

    protected HttpServletResponse response;

    protected HttpSession session;

    @ModelAttribute
    public void setReqAndRes(HttpServletRequest request, HttpServletResponse response) {

        this.request = request;

        this.response = response;

        this.session = request.getSession();

    }

    public XcOauth2Util.UserJwt getUserJwt(){
        //获取当前用户信息
        XcOauth2Util xcOauth2Util = new XcOauth2Util();
        return xcOauth2Util.getUserJwtFromHeader(request);
    }
}
